package javacore.Statements;

public class ArrayTest {

	public static void main(String[] args) {
		int[] list = {10,20,30,40,50,0,-1};

	      // Print all the array elements
	      for (int i = 0; i < list.length; i++) {
	         System.out.println(list[i] + " ");
	      }
	      // Summing all elements
	      int total = 0;
	      for (int i = 0; i < list.length; i++) {
	         total +=list[i];
	      }
	      System.out.println("Total is " + total);
	      
	      // Finding the largest element
	      int max = list[0];
	      for (int i = 1; i < list.length; i++) {
	         if (list[i] > max) max = list[i];
	      }
	      System.out.println("Max is " + max);

	}

}
